home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Disk / Directory / error.h < prev    next >
Encoding:
Text File  |  1993-02-03  |  708 b   |  29 lines  |  [TEXT/KAHL]

  1. //-- error.h
  2.  
  3. // Error management.
  4.  
  5.  
  6. #include <setjmp.h>
  7.  
  8. //-- Constants.
  9.  
  10. #define    MAXJUMP                10                        /* Max level of return that can be done */
  11.  
  12. //-- Error constants.
  13.  
  14. #define    INITOUTMEM            1                        /* Out of memory on init */
  15. #define OUTWINDOWS            2                        /* No more windows to open */
  16. #define OUTMEM                3                        /* Out of memory */
  17.  
  18. //-- Globals.
  19.  
  20. extern jmp_buf callStack[MAXJUMP];
  21. extern short callStackPtr;
  22.  
  23. //-- Macros and functions.
  24.  
  25. extern void Throw(int i);                            /* Call this with error message */
  26. extern void PostError(int i);                        /* Post error message */
  27. #define Catch()            ((callStackPtr < MAXJUMP) ? setjmp(callStack[callStackPtr++]) : 0)
  28. #define Uncatch()        ((callStackPtr > 0) ? --callStackPtr : 0)
  29.